from person import db
from person.models import User
from person.views import user_datastore
from werkzeug.security import generate_password_hash
password = generate_password_hash('123456')
admin = user_datastore.create_user(userID=2020001, phone=15029538668, email='1044607376@qq.com', password=password)
# 生成普通用户角色和admin用户角色
user_datastore.create_role(name='User', description='Generic user role')
admin_role = user_datastore.create_role(name='Admin', description='Admin user role')
Root_role = user_datastore.create_role(name='Root', description='Root user role')
# 为admin添加Admin角色
user_datastore.add_role_to_user(admin, Root_role)
db.session.commit()